<template>
  <div class="take" ref="take">

  <TakeNotes :noteList="noteList"></TakeNotes>
  </div>
</template>

<script>
 import TakeNotes from '@/components/TakeNotes.vue'
 import { Toast } from "vant";
export default {
components:{
  TakeNotes
},
data:function(){
  return {
    noteList:null,
    page:1,
    show:true,
  }
},
methods: {
  sHeight(){
    
   var h=document.documentElement.scrollHeight
   var  htop=document.documentElement.scrollTop
  var  wH=document.documentElement.clientHeight
  
   if(htop+wH>h-3&&this.show){
     this.show=false
     this.page++
     this.axios.get("https://apis.netstart.cn/xpc/notes?page="+this.page).then(res=>{
 
    this.noteList=res.data.data.list
    console.log(this.noteList);
  this.show=true
  })
   }
  },

},
created:function(){
    Toast({
      message: "请稍后",
      icon: "https://img01.yzcdn.cn/vant/logo.png",
      duration: 0,
    });
  this.axios.get("https://apis.netstart.cn/xpc/notes?page="+this.page).then(res=>{
 
    this.noteList=res.data.data.list
    console.log(this.noteList);
     Toast.clear();
  })
 
},
mounted:function(){
 window.addEventListener("scroll", this.sHeight);
},
//   destroyed() {
//      window.removeEventListener("scroll", this.scrollHeight);
//  },

}
</script>

<style>

</style>
